package com.adb.ww2.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;

import com.adb.ww2.Log;
import com.adb.ww2.R;
import com.adb.ww2.fragment.WarDialogFragment;
import com.adb.ww2.fragment.WarDialogFragment.EditNameDialogListener;

public class FragmentDialogOrActivity extends FragmentActivity implements EditNameDialogListener{
	
	public static String TAG = FragmentDialogOrActivity.class.getCanonicalName();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);	
		
		/*if(savedInstanceState == null){
			
			Log.verbose(TAG," [ savedInstanceState == null ]");
			FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            DialogFragment newFragment = WarDialogFragment.newInstance();
            ft.add(R.id.embedded, newFragment);
            ft.commit();
		}*/
		
		showFragmentDialog();
	}
	
	/**
	 * show Dialog
	 */
	
	public void showFragmentDialog(){
		
		FragmentManager mFragmentManager = getSupportFragmentManager();
		WarDialogFragment mWarDialog = WarDialogFragment.newInstance();
		//we here not use Fragment TransactionManager 
		mWarDialog.show(mFragmentManager,"fragment_edit_name");
		
	}
	/**
	 * We listen Dialog Done Event and Result on Dialog Fragment Handle Here 
	 * 
	 */
	@Override
	public void onFinishEditDialog(String inputText) {
		Log.debug(TAG,"RESULT OF DIALOG "  + inputText);
	}
}
